package univer.oko.query.baseObjects;

import java.util.ArrayList;

/**
 * Created by Sergey Kharlamov.
 * Date: 16.07.2006
 * Time: 19:21:07
 */
public class Table extends DBObject {
    private StringBuilder builder;
    private ArrayList<Column> columns;

    public Table() {
        type = DBObjectType.Table;
        columns = new ArrayList<Column>();

    }

    public String getText() {
        if (builder == null) {
            builder = new StringBuilder();
            for (Column col : columns) {
                builder.append(col.getColumnName() + "   " + col.getTypeName() + "  " + col.getLength() + "  " + col.isNullable() + "\n");
            }
        }
        return builder.toString();
    }

    public String getTextWithoutHeader() {
        return getText();
    }

    public void setTextWithoutHeader(String textWithoutHeader) {
        text = textWithoutHeader;

    }

    // "[(/\\*.*\\*/)|(--.*\\n)| |\\n|\\t|\\r]+"
    public void setText(String text) {
        this.text = text;
    }

    public ArrayList<Column> getColumns() {
        return columns;
    }

    public void setColumns(ArrayList<Column> columns) {
        this.columns = columns;
    }


}
